package com.mifan.vo;/*
 * @Author Milan
 * @Date 2024/9/15 14:51
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.mifan.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultData {
    // 当前页
    private Long pageNum;
    // 每页显示的条数
    private Long pageSize;
    // 用户列表
    private List<Object> list;
    // 总条数
    private Long total;

    public static ResultData createResultData(PageInfo page) {
        ResultData resultData = new ResultData();
        resultData.setPageNum((long) page.getPageNum());
        resultData.setPageSize((long) page.getPageSize());
        resultData.setList(page.getList());
        resultData.setTotal(page.getTotal());
        return resultData;
    }
}
